--------------------------------------------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  C:\Users\scott\Documents\publication\Xi Jinping Effect\Xi_Effect.log
  log type:  text
 opened on:  22 Jun 2021, 16:40:14

. 
. *Final Project
. *24 December 2020
. *Scott D. McDonald
. 
. clear

. 
. *import dataset
. use S002 S003 S007 A004 A008 A025 A168 A168A D059 E010 E012 E017 E018 E023 E026 E026B E027 E032 E035 E036 E037 E069_02 E069_04 E069_06 E069_11 E069_12
>  E069_13 E069_17 E069_20 E069_33 E069_60 E107 E110 E111 E114 E115 E121 E122 E123 E128 G006 X001 X002 X007 X023 X025CSWVS X028 X047R using "C:\Users\sc
> ott\Documents\FLETCHER\2020 Fall\EIB-213\Final Project\WVS_TimeSeries_stata_v1_5.dta", clear

. 
. *format dataset
. 
. *only the People's Republic of China
. keep if S003==156
(413,456 observations deleted)

. 
. *set wave dummies
. gen wave2=(S002==2)

. gen wave3=(S002==3)

. gen wave4=(S002==4)

. gen wave5=(S002==5)

. gen wave6=(S002==6)

. gen wave7=(S002==7)

. gen dream=(S002==6 | S002==7)

. 
. 
. *remove non response of key variables
. drop if E023 <=0
(0 observations deleted)

. drop if E069_12 <=0
(0 observations deleted)

. 
. *confidence in ccp with rising values
. gen conf_ccp=.
(10,827 missing values generated)

. replace conf_ccp=0 if E069_12==4 & E069_12!=.
(128 real changes made)

. replace conf_ccp=1 if E069_12==3 & E069_12!=.
(902 real changes made)

. replace conf_ccp=2 if E069_12==2 & E069_12!=.
(4,585 real changes made)

. replace conf_ccp=3 if E069_12==1 & E069_12!=.
(2,914 real changes made)

. 
. *political interest dummy
. gen polint=.
(10,827 missing values generated)

. replace polint=0 if E023==3 | E023==4 & E023!=.
(3,911 real changes made)

. replace polint=1 if E023==1 | E023==2 & E023!=.
(5,064 real changes made)

. 
. *interaction variable
. gen xi_effect=(dream*polint)
(1,852 missing values generated)

. 
. *confidence in government dummy
. gen conf_gov=.
(10,827 missing values generated)

. replace conf_gov=0 if E069_11==3 | E069_11==4 & E069_11!=.
(476 real changes made)

. replace conf_gov=1 if E069_11==1 | E069_11==2 & E069_11!=.
(7,494 real changes made)

. 
. *confidence in media dummy
. gen conf_press=.
(10,827 missing values generated)

. replace conf_press=0 if E069_04==3 | E069_04==4 & E069_04!=.
(2,732 real changes made)

. replace conf_press=1 if E069_04==1 | E069_04==2 & E069_04!=.
(5,711 real changes made)

. 
. *government v personal responsibility dummy
. gen gov_res=.
(10,827 missing values generated)

. replace gov_res=0 if E037==1 | E037==2 | E037==3 | E037==4 | E037==5 & E037!=.
(4,647 real changes made)

. replace gov_res=1 if E037>=6 & E037!=.
(5,511 real changes made)

. 
. *nationalism dummy
. gen nationalism=.
(10,827 missing values generated)

. replace nationalism=0 if G006==3 | G006==4 & G006!=.
(1,391 real changes made)

. replace nationalism=1 if G006==1 | G006==2 & G006!=.
(8,979 real changes made)

. 
. *respect for authority dummy
. gen res_authority=.
(10,827 missing values generated)

. replace res_authority=0 if E018==3 & E018!=.
(1,875 real changes made)

. replace res_authority=1 if E018==1 | E018==2 & E018!=.
(7,872 real changes made)

. 
. *confidence in military dummy
. gen conf_mil=.
(10,827 missing values generated)

. replace conf_mil=0 if E069_02==3 & E069_02!=.
(463 real changes made)

. replace conf_mil=1 if E069_02==1 | E069_02==2 & E069_02!=.
(8,260 real changes made)

. 
. *Is politics important in life dummy
. gen import_pol=.
(10,827 missing values generated)

. replace import_pol=0 if A004==3 | A004==4 & A004!=.
(4,482 real changes made)

. replace import_pol=1 if A004==1 | A004==2 & A004!=.
(5,525 real changes made)

. 
. *demographic dummoies
. gen female=(X001==2)

. gen married=(X007==1)

. gen year=.
(10,827 missing values generated)

. replace year=1990 if S002==2 & S002!=.
(1,000 real changes made)

. replace year=1995 if S002==3 & S002!=.
(1,500 real changes made)

. replace year=2001 if S002==4 & S002!=.
(1,000 real changes made)

. replace year=2007 if S002==5 & S002!=.
(1,991 real changes made)

. replace year=2013 if S002==6 & S002!=.
(2,300 real changes made)

. replace year=2018 if S002==7 & S002!=.
(3,036 real changes made)

. gen age=(year-X002)

. 
. *years of education dummy
. gen degree=.
(10,827 missing values generated)

. replace degree=1 if X023>=21 & X023!=.
(736 real changes made)

. replace degree=0 if X023<=20 & X023!=.
(4,948 real changes made)

. 
. ****Run the Regressions*****
. 
. *basic regression (Model 1)
. ologit conf_ccp polint

Iteration 0:   log likelihood = -8357.4307  
Iteration 1:   log likelihood = -8285.9551  
Iteration 2:   log likelihood = -8285.8007  
Iteration 3:   log likelihood = -8285.8007  

Ordered logistic regression                     Number of obs     =      8,324
                                                LR chi2(1)        =     143.26
                                                Prob > chi2       =     0.0000
Log likelihood = -8285.8007                     Pseudo R2         =     0.0086

------------------------------------------------------------------------------
    conf_ccp |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      polint |   .5166043   .0434036    11.90   0.000     .4315348    .6016739
-------------+----------------------------------------------------------------
       /cut1 |  -3.893927   .0915483                     -4.073358   -3.714495
       /cut2 |  -1.699943   .0400438                     -1.778427   -1.621458
       /cut3 |   .9648348    .035262                      .8957226    1.033947
------------------------------------------------------------------------------

. estimates store model1

. 
. *basic dif-in-dif regression (model 2)
. ologit conf_ccp xi_effect dream polint

Iteration 0:   log likelihood = -8357.4307  
Iteration 1:   log likelihood = -8268.1382  
Iteration 2:   log likelihood = -8267.8761  
Iteration 3:   log likelihood = -8267.8761  

Ordered logistic regression                     Number of obs     =      8,324
                                                LR chi2(3)        =     179.11
                                                Prob > chi2       =     0.0000
Log likelihood = -8267.8761                     Pseudo R2         =     0.0107

------------------------------------------------------------------------------
    conf_ccp |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
   xi_effect |  -.2306789    .091358    -2.52   0.012    -.4097374   -.0516204
       dream |   .3844573   .0724152     5.31   0.000     .2425262    .5263884
      polint |   .7093338   .0736206     9.63   0.000     .5650401    .8536275
-------------+----------------------------------------------------------------
       /cut1 |  -3.630921   .1038319                     -3.834427   -3.427414
       /cut2 |  -1.433695   .0638953                     -1.558928   -1.308463
       /cut3 |   1.240653   .0630559                      1.117066    1.364241
------------------------------------------------------------------------------

. estimates store model2

. 
. *dif-in-dif with controls (model 3)
. ologit conf_ccp xi_effect dream polint age female married X047R import_pol

Iteration 0:   log likelihood = -6780.7015  
Iteration 1:   log likelihood =  -6574.392  
Iteration 2:   log likelihood = -6572.8309  
Iteration 3:   log likelihood = -6572.8298  
Iteration 4:   log likelihood = -6572.8298  

Ordered logistic regression                     Number of obs     =      6,642
                                                LR chi2(8)        =     415.74
                                                Prob > chi2       =     0.0000
Log likelihood = -6572.8298                     Pseudo R2         =     0.0307

------------------------------------------------------------------------------
    conf_ccp |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
   xi_effect |  -.3552802   .1117925    -3.18   0.001    -.5743894    -.136171
       dream |   .4865781   .0906891     5.37   0.000     .3088308    .6643254
      polint |   .6248767   .0993987     6.29   0.000     .4300589    .8196945
         age |   .0151732   .0017799     8.52   0.000     .0116846    .0186617
      female |   .0804755   .0482643     1.67   0.095    -.0141207    .1750717
     married |   .1058547   .0637925     1.66   0.097    -.0191763    .2308857
       X047R |  -.1021168   .0440646    -2.32   0.020    -.1884818   -.0157517
  import_pol |   .6063923   .0519167    11.68   0.000     .5046374    .7081471
-------------+----------------------------------------------------------------
       /cut1 |  -2.692925   .1591669                     -3.004886   -2.380963
       /cut2 |  -.4813272   .1341704                     -.7442963   -.2183581
       /cut3 |   2.173276   .1371869                      1.904394    2.442157
------------------------------------------------------------------------------

. estimates store model3

. 
. *dif-in-dif with controls (model 4)
. 
. ologit conf_ccp xi_effect dream polint age female married X047R import_pol if S002>=5 &S002<=6

Iteration 0:   log likelihood = -2952.2751  
Iteration 1:   log likelihood = -2866.8488  
Iteration 2:   log likelihood = -2866.1851  
Iteration 3:   log likelihood = -2866.1847  
Iteration 4:   log likelihood = -2866.1847  

Ordered logistic regression                     Number of obs     =      2,827
                                                LR chi2(8)        =     172.18
                                                Prob > chi2       =     0.0000
Log likelihood = -2866.1847                     Pseudo R2         =     0.0292

------------------------------------------------------------------------------
    conf_ccp |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
   xi_effect |  -.3575374   .1566581    -2.28   0.022    -.6645816   -.0504932
       dream |   .2592137   .1243254     2.08   0.037     .0155405     .502887
      polint |   .6494715   .1302519     4.99   0.000     .3941825    .9047606
         age |   .0141596   .0026901     5.26   0.000     .0088871    .0194321
      female |   .0330904   .0740645     0.45   0.655    -.1120734    .1782542
     married |   .3743388   .0988034     3.79   0.000     .1806876    .5679899
       X047R |  -.1000768   .0669343    -1.50   0.135    -.2312656    .0311119
  import_pol |   .5036506   .0797541     6.32   0.000     .3473354    .6599658
-------------+----------------------------------------------------------------
       /cut1 |  -2.602783   .2382616                     -3.069767   -2.135799
       /cut2 |  -.3616736   .2043048                     -.7621036    .0387564
       /cut3 |   2.235973   .2094071                      1.825542    2.646403
------------------------------------------------------------------------------

. estimates store model4

. 
. *dif-in-dif with additionaly confidence controls (model 5)
. ologit conf_ccp xi_effect dream polint conf_gov conf_mil conf_press gov_res nationalism res_authority

Iteration 0:   log likelihood =  -5998.015  
Iteration 1:   log likelihood = -5638.7484  
Iteration 2:   log likelihood =  -5378.117  
Iteration 3:   log likelihood =  -5288.173  
Iteration 4:   log likelihood =  -5285.907  
Iteration 5:   log likelihood = -5285.9068  

Ordered logistic regression                     Number of obs     =      6,194
                                                LR chi2(9)        =    1424.22
                                                Prob > chi2       =     0.0000
Log likelihood = -5285.9068                     Pseudo R2         =     0.1187

-------------------------------------------------------------------------------
     conf_ccp |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
--------------+----------------------------------------------------------------
    xi_effect |  -.0571013   .1241471    -0.46   0.646    -.3004252    .1862226
        dream |   .2123753   .1032142     2.06   0.040     .0100792    .4146714
       polint |   .4458643   .1090978     4.09   0.000     .2320366    .6596919
     conf_gov |   3.527833   .1482871    23.79   0.000     3.237196    3.818471
     conf_mil |   1.102081    .136545     8.07   0.000     .8344576    1.369704
   conf_press |   .4960715   .0587958     8.44   0.000     .3808339    .6113091
      gov_res |  -.0688002   .0513089    -1.34   0.180    -.1693639    .0317634
  nationalism |   .4963771   .0894503     5.55   0.000     .3210578    .6716965
res_authority |   .2518118   .0684451     3.68   0.000     .1176619    .3859617
--------------+----------------------------------------------------------------
        /cut1 |  -.4339624   .1993696                     -.8247197   -.0432052
        /cut2 |   3.217152   .2030566                      2.819168    3.615135
        /cut3 |   6.543179   .2168764                      6.118109    6.968249
-------------------------------------------------------------------------------

. estimates store model5

. 
. *dif-in-dif with best of all controls (model 6)
. ologit conf_ccp xi_effect dream polint age female married X047R import_pol conf_press gov_res res_authority

Iteration 0:   log likelihood = -6247.3933  
Iteration 1:   log likelihood = -5916.0864  
Iteration 2:   log likelihood = -5911.2677  
Iteration 3:   log likelihood =  -5911.256  
Iteration 4:   log likelihood =  -5911.256  

Ordered logistic regression                     Number of obs     =      6,103
                                                LR chi2(11)       =     672.27
                                                Prob > chi2       =     0.0000
Log likelihood =  -5911.256                     Pseudo R2         =     0.0538

-------------------------------------------------------------------------------
     conf_ccp |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
--------------+----------------------------------------------------------------
    xi_effect |  -.3224868   .1216428    -2.65   0.008    -.5609024   -.0840713
        dream |   .4413874   .0997283     4.43   0.000     .2459235    .6368513
       polint |    .551658   .1098044     5.02   0.000     .3364454    .7668706
          age |    .013012   .0019039     6.83   0.000     .0092804    .0167435
       female |   .0620214   .0507123     1.22   0.221    -.0373729    .1614158
      married |    .110597   .0668158     1.66   0.098    -.0203596    .2415537
        X047R |  -.0956566   .0463709    -2.06   0.039    -.1865419   -.0047712
   import_pol |   .5763917   .0546808    10.54   0.000     .4692193    .6835641
   conf_press |   .8716745   .0560559    15.55   0.000     .7618069     .981542
      gov_res |  -.1876925    .050615    -3.71   0.000    -.2868962   -.0884889
res_authority |   .2014996   .0631004     3.19   0.001     .0778251    .3251741
--------------+----------------------------------------------------------------
        /cut1 |  -2.289358   .1724023                      -2.62726   -1.951455
        /cut2 |  -.0509234    .149142                     -.3432363    .2413896
        /cut3 |   2.698991   .1541661                      2.396831    3.001152
-------------------------------------------------------------------------------

. estimates store model6

. 
. *table creation
. estimates table model1 model2 model3 model4 model5 model6, b(%10.3f) se(%10.3f) stats(rmse r2 N) title(Xi Jinping Effect on Confidence in the CCP)

Xi Jinping Effect on Confidence in the CCP

--------------------------------------------------------------------------------------------
    Variable |   model1       model2       model3       model4       model5       model6    
-------------+------------------------------------------------------------------------------
conf_ccp     |
      polint |      0.517        0.709        0.625        0.649        0.446        0.552  
             |      0.043        0.074        0.099        0.130        0.109        0.110  
   xi_effect |                  -0.231       -0.355       -0.358       -0.057       -0.322  
             |                   0.091        0.112        0.157        0.124        0.122  
       dream |                   0.384        0.487        0.259        0.212        0.441  
             |                   0.072        0.091        0.124        0.103        0.100  
         age |                                0.015        0.014                     0.013  
             |                                0.002        0.003                     0.002  
      female |                                0.080        0.033                     0.062  
             |                                0.048        0.074                     0.051  
     married |                                0.106        0.374                     0.111  
             |                                0.064        0.099                     0.067  
       X047R |                               -0.102       -0.100                    -0.096  
             |                                0.044        0.067                     0.046  
  import_pol |                                0.606        0.504                     0.576  
             |                                0.052        0.080                     0.055  
    conf_gov |                                                          3.528               
             |                                                          0.148               
    conf_mil |                                                          1.102               
             |                                                          0.137               
  conf_press |                                                          0.496        0.872  
             |                                                          0.059        0.056  
     gov_res |                                                         -0.069       -0.188  
             |                                                          0.051        0.051  
 nationalism |                                                          0.496               
             |                                                          0.089               
res_author~y |                                                          0.252        0.201  
             |                                                          0.068        0.063  
-------------+------------------------------------------------------------------------------
       /cut1 |     -3.894       -3.631       -2.693       -2.603       -0.434       -2.289  
             |      0.092        0.104        0.159        0.238        0.199        0.172  
       /cut2 |     -1.700       -1.434       -0.481       -0.362        3.217       -0.051  
             |      0.040        0.064        0.134        0.204        0.203        0.149  
       /cut3 |      0.965        1.241        2.173        2.236        6.543        2.699  
             |      0.035        0.063        0.137        0.209        0.217        0.154  
-------------+------------------------------------------------------------------------------
Statistics   |                                                                              
        rmse |                                                                              
          r2 |                                                                              
           N |       8324         8324         6642         2827         6194         6103  
--------------------------------------------------------------------------------------------
                                                                                legend: b/se

. 
. log close
      name:  <unnamed>
       log:  C:\Users\scott\Documents\publication\Xi Jinping Effect\Xi_Effect.log
  log type:  text
 closed on:  22 Jun 2021, 16:40:23
--------------------------------------------------------------------------------------------------------------------------------------------------------
